<template>
  <view>
    <view class="cu-card-wrap" style="margin-bottom: 16px" v-for="(item, index) in tickets" :key="index">
      <view class="body-wrap">
        <view class="content-wrap">
          <view class="label">作业类型：</view>
          <view class="value">{{ item.workTypeLabel }}{{ item.levelLabel ? `（${item.levelLabel}）` : '' }}</view>
        </view>
        <view class="content-wrap">
          <view class="label">作业点：</view>
          <view class="value">{{ item.operationPoint }}</view>
        </view>
        <view class="content-wrap">
          <view class="label">作业区域：</view>
          <view class="value">{{ item.areaName }}</view>
        </view>
        <view class="content-wrap">
          <view class="label">作业内容：</view>
          <view class="value">{{ item.workContent }}</view>
        </view>
        <view class="content-wrap">
          <view class="label">作业单位类型：</view>
          <view class="value">{{ item.unitTypeLabel }}</view>
        </view>
        <view class="content-wrap">
          <view class="label">作业单位：</view>
          <view class="value">{{ item.unitName }}</view>
        </view>
        <view class="content-wrap">
          <view class="label">作业单位负责人：</view>
          <view class="value">{{ item.directorName }}</view>
        </view>
        <view class="content-wrap">
          <view class="label">风险辨识结果：</view>
          <view class="value">{{ riskIdentification(item.riskIdentification) }} </view>
        </view>
      </view>
    </view>
  </view>
</template>
<script>
export default {
  name: 'TicketInfo',
  props: {
    tickets: {
      type: Array,
      default: () => []
    }
  },
  methods: {
    riskIdentification(risk) {
      if (!risk) {
        return ''
      }
      const obj = JSON.parse(risk)
      return obj.map((item) => item.riskType).join('、')
    }
  }
}
</script>
<style scoped lang="scss"></style>
